package com.example.jiemian.pojo;

import android.os.Parcel;
import android.os.Parcelable;

public class Sensor {
    //定义一个名字
    private String sensorName;
    //定义一个单位
    private String dateUnit;
    //定义一个值
    private double date;

    //获取名字方法
    public String getSensorName(){
        return sensorName;
    }
    //设置名字方法
    public void setSensorName(String sensorName){
        this.sensorName=sensorName;
    }

    //获取单位
    public  String getDateUnit(){
        return dateUnit;
    }
    //设置方法
    public  void setDateUnit(String dateUnit){
        this.dateUnit=dateUnit;
    }

    //获取值
    public double getDate(){
        return date;
    }
    //设置值
    public  void setDate(double date){
        this.date=date;
    }

    //实例化对象就可以传入相关数据
    public Sensor(String sensorName,String dateUnit,double date){
        this.sensorName=sensorName;
        this.dateUnit=dateUnit;
        this.date=date;
    }
    //通过容器将数据传入到实体中
    protected Sensor(Parcel in){
        sensorName=in.readString();
        dateUnit=in.readString();
        date=in.readDouble();
    }

    public static final Parcelable.Creator<Sensor> CREATOR=new Parcelable.Creator<Sensor>() {
        @Override
        public Sensor createFromParcel(Parcel source) {
            return new Sensor(source);
        }

        @Override
        public Sensor[] newArray(int size) {
            return new Sensor[size];
        }
    };


}
